#include <Texture2D.hpp>

namespace Olorin
{
	namespace Graphics
	{
		Texture2D::Texture2D()
		{
			textureID = 0;
		}

		Texture2D::Texture2D(const char* filename)
		{
			original = true;
			load(filename);
		}

		Texture2D::~Texture2D()
		{
			if(original)
				glDeleteTextures(1, &textureID);
		}

		void Texture2D::load(const char* filename)
		{
			if(textureID == 0)
			{
				original = true;
				glGenTextures(1, &textureID);
			}
			/*
			BitmapInfo *info;
			unsigned char *data;
			data = Bitmap::loadBitmap(filename, &info);
			glBindTexture(GL_TEXTURE_2D, textureID);
			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, info->header.width, 
				info->header.height, 0, GL_BGR, GL_UNSIGNED_BYTE, data);
			glBindTexture(GL_TEXTURE_2D, 0);
			free(info);
			free(data);
			*/
		}
	}
}